home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / dialog / dialog.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-10-18  |  8.0 KB  |  279 lines

  1. VERSION 2.00
  2. Begin Form frmMyDialog 
  3.    BorderStyle     =   3  'Fixed Double
  4.    ClientHeight    =   3090
  5.    ClientLeft      =   1785
  6.    ClientTop       =   2205
  7.    ClientWidth     =   6480
  8.    ControlBox      =   0   'False
  9.    Height          =   3495
  10.    Left            =   1725
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   3090
  15.    ScaleWidth      =   6480
  16.    Top             =   1860
  17.    Width           =   6600
  18.    Begin CommandButton CommandButton 
  19.       Caption         =   "Command1"
  20.       FontBold        =   -1  'True
  21.       FontItalic      =   0   'False
  22.       FontName        =   "System"
  23.       FontSize        =   9.75
  24.       FontStrikethru  =   0   'False
  25.       FontUnderline   =   0   'False
  26.       Height          =   465
  27.       Index           =   0
  28.       Left            =   225
  29.       TabIndex        =   0
  30.       Top             =   2475
  31.       Visible         =   0   'False
  32.       Width           =   1185
  33.    End
  34.    Begin Label pnlCaption 
  35.       Alignment       =   2  'Center
  36.       BackColor       =   &H00800000&
  37.       Caption         =   "Label1"
  38.       FontBold        =   -1  'True
  39.       FontItalic      =   0   'False
  40.       FontName        =   "System"
  41.       FontSize        =   9.75
  42.       FontStrikethru  =   0   'False
  43.       FontUnderline   =   0   'False
  44.       ForeColor       =   &H00FFFFFF&
  45.       Height          =   270
  46.       Left            =   15
  47.       TabIndex        =   2
  48.       Top             =   15
  49.       Width           =   6450
  50.    End
  51.    Begin Image imgIcon 
  52.       Height          =   480
  53.       Index           =   3
  54.       Left            =   45
  55.       Picture         =   DIALOG.FRX:0000
  56.       Top             =   1665
  57.       Visible         =   0   'False
  58.       Width           =   480
  59.    End
  60.    Begin Image imgIcon 
  61.       Height          =   480
  62.       Index           =   2
  63.       Left            =   45
  64.       Picture         =   DIALOG.FRX:083A
  65.       Top             =   1125
  66.       Visible         =   0   'False
  67.       Width           =   480
  68.    End
  69.    Begin Image imgIcon 
  70.       Height          =   480
  71.       Index           =   1
  72.       Left            =   45
  73.       Picture         =   DIALOG.FRX:1074
  74.       Top             =   585
  75.       Visible         =   0   'False
  76.       Width           =   480
  77.    End
  78.    Begin Image imgIcon 
  79.       Height          =   450
  80.       Index           =   0
  81.       Left            =   45
  82.       Picture         =   DIALOG.FRX:18AE
  83.       Top             =   90
  84.       Visible         =   0   'False
  85.       Width           =   465
  86.    End
  87.    Begin Label lblMessage 
  88.       AutoSize        =   -1  'True
  89.       Caption         =   "12"
  90.       FontBold        =   -1  'True
  91.       FontItalic      =   0   'False
  92.       FontName        =   "System"
  93.       FontSize        =   9.75
  94.       FontStrikethru  =   0   'False
  95.       FontUnderline   =   0   'False
  96.       Height          =   240
  97.       Left            =   720
  98.       TabIndex        =   1
  99.       Top             =   450
  100.       Width           =   5685
  101.       WordWrap        =   -1  'True
  102.    End
  103. Option Explicit
  104. Dim fgParms(1 To 3) As String
  105. Dim fgintPCount As Integer
  106. Sub CommandButton_Click (Index As Integer)
  107. Select Case Val(fgParms(2)) Mod 8
  108.     Case 0
  109.         akRetVal = 1
  110.     Case 1
  111.         Select Case Index
  112.             Case 0
  113.                 akRetVal = 1
  114.             Case 1
  115.                 akRetVal = 2
  116.         End Select
  117.         
  118.     Case 2
  119.         Select Case Index
  120.             Case 0
  121.                 akRetVal = 3
  122.             Case 1
  123.                 akRetVal = 4
  124.             Case 2
  125.                 akRetVal = 5
  126.         End Select
  127.     Case 3
  128.         Select Case Index
  129.             Case 0
  130.                 akRetVal = 6
  131.             Case 1
  132.                 akRetVal = 7
  133.             Case 2
  134.                 akRetVal = 2
  135.         End Select
  136.     Case 4
  137.         Select Case Index
  138.             Case 0
  139.                 akRetVal = 6
  140.             Case 1
  141.                 akRetVal = 7
  142.         End Select
  143.     Case 5
  144.         Select Case Index
  145.             Case 0
  146.                 akRetVal = 4
  147.             Case 1
  148.                 akRetVal = 2
  149.         End Select
  150. End Select
  151. Unload Me
  152. End Sub
  153. Sub Form_Activate ()
  154. Dim lNumberOfButtons As Integer
  155. Dim lFormWidth As Integer
  156. Dim lButtonMid As Integer
  157. Dim lCButton As Integer
  158. Dim lParameters As String
  159. Dim lintWhereComma As Integer
  160. Dim I%
  161. Dim lRectForm As RECT
  162. Dim lTX As Integer
  163. Dim lTY As Integer
  164. Dim lImageNumber As Integer
  165. Dim lDefButton As Integer
  166. lTX = Screen.TwipsPerPixelX
  167. lTY = Screen.TwipsPerPixelY
  168. lParameters = Me.Tag
  169. fgintPCount = 1
  170. lintWhereComma = InStr(lParameters, ",")
  171. Do While lintWhereComma > 0
  172.     fgParms(fgintPCount) = Left$(lParameters, lintWhereComma - 1)
  173.     lParameters = Mid$(lParameters, lintWhereComma + 1)
  174.     fgintPCount = fgintPCount + 1
  175.     lintWhereComma = InStr(lParameters, ",")
  176. fgParms(fgintPCount) = lParameters
  177. lImageNumber = -1
  178. Select Case Val(fgParms(2)) And (768)
  179.     Case 0
  180.         lDefButton = 0
  181.     Case 256
  182.         lDefButton = 1
  183.     Case 512
  184.         lDefButton = 2
  185. End Select
  186. Select Case Val(fgParms(2)) And (112)
  187.     Case 16
  188.         lImageNumber = 0
  189.     Case 32
  190.         lImageNumber = 1
  191.     Case 48
  192.         lImageNumber = 2
  193.     Case 64
  194.         lImageNumber = 3
  195. End Select
  196. If lImageNumber >= 0 Then
  197.     imgIcon(lImageNumber).Visible = True
  198.     imgIcon(lImageNumber).Left = 60
  199.     lblMessage.Left = 240 + (32 * lTX)
  200. End If
  201. lblMessage = fgParms(1)
  202. If lImageNumber >= 0 Then
  203.     'If lblMessage.Height > (32 * lTX) Then
  204.         imgIcon(lImageNumber).Top = lblMessage.Top + (lblMessage.Height / 2) - (imgIcon(lImageNumber).Height / 2)
  205.     'Else
  206.     '    imgIcon(lImageNumber).Top = lblMessage.Top
  207.     'End If
  208. End If
  209. Me.Height = lblMessage.Height + CommandButton(0).Height + 270 + 600
  210. CommandButton(0).Top = Me.ScaleHeight - CommandButton(0).Height - 90
  211. lRectForm.Left = Me.Left / lTX
  212. lRectForm.Top = Me.Top / lTY
  213. lRectForm.right = lRectForm.Left + Me.Width / lTX
  214. lRectForm.bottom = lRectForm.Top + Me.Height / lTY
  215. setCursorPos (lRectForm.Left + 10), (lRectForm.Top + 10)
  216. DoEvents
  217. ClipCursorRect lRectForm
  218. If fgintPCount < 3 Then
  219.     Me!pnlCaption = app.EXEName
  220.     Me!pnlCaption = fgParms(3)
  221. End If
  222. If fgintPCount < 2 Then
  223.     fgParms(2) = "0"
  224. End If
  225. Select Case Val(fgParms(2)) Mod 8
  226.     Case 0
  227.         lNumberOfButtons = 1
  228.         CommandButton(0).Caption = "OK"
  229.         lDefButton = 0
  230.     Case 1
  231.         Load CommandButton(1)
  232.         CommandButton(0).Caption = "OK"
  233.         CommandButton(1).Caption = "Cancel"
  234.         If lDefButton > 1 Then
  235.             lDefButton = 0
  236.         End If
  237.         lNumberOfButtons = 2
  238.     Case 2
  239.         Load CommandButton(1)
  240.         Load CommandButton(2)
  241.         CommandButton(0).Caption = "Abort"
  242.         CommandButton(1).Caption = "Retry"
  243.         CommandButton(2).Caption = "Ignore"
  244.         lNumberOfButtons = 3
  245.     Case 3
  246.         Load CommandButton(1)
  247.         Load CommandButton(2)
  248.         CommandButton(0).Caption = "Yes"
  249.         CommandButton(1).Caption = "No"
  250.         CommandButton(2).Caption = "Cancel"
  251.         lNumberOfButtons = 3
  252.     Case 4
  253.         Load CommandButton(1)
  254.         CommandButton(0).Caption = "Yes"
  255.         CommandButton(1).Caption = "No"
  256.         lNumberOfButtons = 2
  257.         If lDefButton > 1 Then
  258.             lDefButton = 0
  259.         End If
  260.     Case 5
  261.         Load CommandButton(1)
  262.         CommandButton(0).Caption = "Retry"
  263.         CommandButton(1).Caption = "Cancel"
  264.         lNumberOfButtons = 2
  265.         If lDefButton > 1 Then
  266.             lDefButton = 0
  267.         End If
  268. End Select
  269. lFormWidth = Me.ScaleWidth
  270. lButtonMid = lFormWidth / (lNumberOfButtons + 1)
  271. For lCButton = 0 To lNumberOfButtons - 1
  272.     CommandButton(lCButton).Left = (lButtonMid * (lCButton + 1)) - (CommandButton(lCButton).Width / 2)
  273.     CommandButton(lCButton).Visible = True
  274. CommandButton(lDefButton).SetFocus
  275. End Sub
  276. Sub Form_Unload (Cancel As Integer)
  277.     ClipCursorClear 0&
  278. End Sub
  279.